#ifndef _KEY_H_
#define _KEY_H_

#include <rtdevice.h>
#include <rtthread.h>
#include <board.h>

#define KEY_PRESS_VALUE 0

#define MY_KEY_LIST_MAX 20
#define MY_KEY_DOWN_MS  50
#define MY_KEY_HOLD_MS 700
#define MY_KEY_SCAN_SPACE_MS 20



typedef void (*my_key_callback)(void*);

enum my_key_event
{
    KEY_EVENT_CLICK_DOWN,
    KEY_EVENT_CLICK_UP,
    KEY_EVENT_HOLD,
    KEY_EVENT_HOLD_CYC,
    KEY_EVENT_HOLD_UP,
    KEY_EVENT_NONE
};

struct my_key
{
    rt_uint8_t press_logic_level;
    rt_uint16_t cnt;
    rt_uint16_t hold_cyc_period;
    rt_uint16_t pin;

    enum my_key_event event;

    my_key_callback cb;

};



int my_key_register(struct my_key *key);
int my_key_start(void);



#endif
